#ifndef _CCSKELETALANIMATION_H_
#define _CCSKELETALANIMATION_H_

#include "CCSpineObject.h"
#include "CCTransform.h"
#include "CCSpineGlobal.h"

NS_CC_BEGIN

struct SpineEvents {
    string name;
    
    int m_int;
    float m_float;
    string m_string;
};

/**
 * general model of skeletal animation
 */

class CCSkeletalAnimation : public CCSpineObject {
	friend class CCSpineLoader;
	
public:
    struct EventsKeyFrame : public SpineEvents {
        float time;
    };
    
	/// transform list
	typedef vector<CCTransform*> TransformPtrList;
    
    typedef vector<EventsKeyFrame> EventsKeyFrameList;
	
private:
	/// list of transform
	TransformPtrList m_transList;
	
	/// duration time of this animation
	float m_duration;
	EventsKeyFrameList m_ekfList;
	
protected:
	CCSkeletalAnimation();
	
public:
	virtual ~CCSkeletalAnimation();
	static CCSkeletalAnimation* create();
	
	/// add transform
	void addTransform(CCTransform* t);
	
	/// get list of transform
	TransformPtrList& getTransformList() { return m_transList; }
    
    virtual void applyTo(CCSkeletalSprite* owner, float frameTime, float delta);//for events
    
    void addEventsKeyFrame(const EventsKeyFrame& kf);
	
	/// get duration time
	float getDuration() { return m_duration; }
};

NS_CC_END

#endif // __CCSkeletalAnimation_h__
